﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChapterX.Common;
using ChapterX.Data.DigitizationDSTableAdapters;
using System.Data;

namespace ChapterX.Modules
{
    public partial class BookBasicInfo : ChapterX.Model.ModuleBase
    {
        protected String title;
        protected String ISBN;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int bookId;

                if (Utils.HasValue(Request.QueryString[QueryKeys.BOOK_ID]) &&
                    Int32.TryParse(Utils.GetValue(Request.QueryString[QueryKeys.BOOK_ID]), out bookId))
                {
                    DigitizationViewTableAdapter adapter = new DigitizationViewTableAdapter();

                    DataTable table = adapter.GetDigitizationByBookIdFromView(bookId);
                    if (table != null && table.Rows.Count > 0)
                    {
                        DataRow row = table.Rows[0];

                        this.title = row["Title"].ToString();
                        this.ISBN = row["ISBN"].ToString();

                    }
                }
            }
        }
    }
}